//
//  TTNetHelper.h
//  01-AFN
//
//  Created by peironggao on 2017/10/14.
//  Copyright © 2017年 gaopeirong. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *TTNetHelperResponseDomain;
extern NSString *TTNetHelperResponseUserDomainKey;

@interface TTNetHelper : NSObject

/*
    取消当前所有请求
 */
- (void)cancelAllRequests;

/*
    根据请求的key来取消某个请求
 */
- (void)cancelRequestByKey:(NSString *)key;


- (NSString *)getRequestWithAPI:(NSString *)api
                         params:(NSDictionary *)params
                        success:(void (^)(id responseObject))success
                        failure:(void (^)(NSError *error))failure;

- (NSString *)getRequestWithURLString:(NSString *)urlString
                               params:(NSDictionary *)params
                              success:(void (^)(id responseObject))success
                              failure:(void (^)(NSError *error))failure;

- (NSString *)postRequestWithAPI:(NSString *)api
                          params:(NSDictionary *)params
                         success:(void (^)(id responseObject))success
                         failure:(void (^)(NSError *error))failure;

- (NSString *)postRequestWithURLString:(NSString *)urlString
                                params:(NSDictionary *)params
                               success:(void (^)(id responseObject))success
                               failure:(void (^)(NSError *error))failure;



@end
